package com.ld.businesscard_manage.utils;

import com.alibaba.excel.util.ListUtils;
import com.ld.businesscard_manage.bean.AllCardsExcel;
import com.ld.businesscard_manage.bean.BusinessCard;
import java.util.List;

public class ExcelUtil {
	public static List<AllCardsExcel> data(List<BusinessCard> cards) {
		List<AllCardsExcel> list = ListUtils.newArrayList();
		for (BusinessCard card : cards) {
			AllCardsExcel data = new AllCardsExcel();
			data.setName(card.getName());
			Integer sex0 = card.getSex();
			String sex;
			if(sex0 == 0){
				sex = "男";
			}else {
				sex = "女";
			}
			data.setSex(sex);
			data.setAccount(card.getAccount());
			data.setPassword(card.getPassword());
			data.setEmail(card.getEmail());
			Integer valid0 = card.getValid();
			String valid;
			if(valid0 == 0){
				valid = "正在使用";
			}else if (valid0 == 1){
				valid = "待删除";
			}else {
				valid = "已删除";
			}
			data.setValid(valid);
			list.add(data);
		}
		System.out.println(list);

		return list;
	}
	public static List<AllCardsExcel> myData(List<BusinessCard> cards) {
		List<AllCardsExcel> list = ListUtils.newArrayList();
		for (BusinessCard card : cards) {
			AllCardsExcel data = new AllCardsExcel();
			data.setName(card.getName());
			Integer sex0 = card.getSex();
			String sex;
			if(sex0 == 0){
				sex = "男";
			}else {
				sex = "女";
			}
			data.setSex(sex);
			data.setEmail(card.getEmail());
			Integer valid0 = card.getValid();
			String valid;
			if(valid0 == 0){
				valid = "正在使用";
			}else if (valid0 == 1){
				valid = "待删除";
			}else {
				valid = "已删除";
			}
			data.setValid(valid);
			list.add(data);
		}
		System.out.println(list);

		return list;
	}
}
